/*
 * @Descripttion: 
 * @version: 
 * @Author: ada.wu
 * @Date: 2024-01-05 10:17:42
 * @LastEditors: ada.wu
 * @LastEditTime: 2024-04-09 16:57:05
 */




const getImagetalkingid = () => {
    return localStorage.getItem('imagetalkingid')
}
const setImagetalkingid = (val: string) => {
    localStorage.setItem('imagetalkingid', val)
}
const removeImagetalkingid = () => {
    localStorage.removeItem('imagetalkingid')
}

//临时token
const getCustomerAuthorization = () => {
    return localStorage.getItem('customer-authorization')
}
const setCustomerAuthorization = (authorization: string) => {
    localStorage.setItem('customer-authorization', authorization)
}
const removeCustomerAuthorization = () => {
    localStorage.removeItem('customer-authorization')
}



const getSystemCode = () => {
    return localStorage.getItem('COUPON_SYSTEM_CODE')
}
const setSystemCode = (systemCode: string) => {
    localStorage.setItem('COUPON_SYSTEM_CODE', systemCode)
}

const removeSystemCode = () => {
    localStorage.removeItem('COUPON_SYSTEM_CODE')
}





//用户token
const getToken = () => {
    return localStorage.getItem('Token')
}
const setToken = (token: string) => {
    localStorage.setItem('Token', token)
}
const removeToken = () => {
    localStorage.removeItem('Token')
}


//用户
const getDingUserInfo = () => {
    if (sessionStorage.getItem('USER_DING_INFO')) {
        return JSON.parse(sessionStorage.getItem('USER_DING_INFO') || '{}')
    } else {
        return ''
    }
}
const setDingUserInfo = (data: string) => {
    sessionStorage.setItem('USER_DING_INFO', JSON.stringify(data))
}
const removeDingUserInfo = () => {
    sessionStorage.removeItem('USER_DING_INFO')
}

export default {
    setImagetalkingid,
    getImagetalkingid,
    removeImagetalkingid,
    getCustomerAuthorization,
    setCustomerAuthorization,
    removeCustomerAuthorization,
    getToken,
    setToken,
    removeToken,
    getSystemCode,
    setSystemCode,
    removeSystemCode,
    getDingUserInfo,
    setDingUserInfo,
    removeDingUserInfo,
}
